import pandas as pd
import numpy as np
from tkinter.filedialog import *
import matplotlib.pyplot as plt


def readcsv():
    # read csv by pandas
    filename = askopenfile()
    csv_data = pd.read_csv(filename, header=None)  # no headers
    # read columns to list
    colname = csv_data.columns
    coldata = {}

    for i in colname:
        coldata[i] = csv_data[i].values
        print(coldata[i].dtype)
    return coldata
    # type of coldata is pandas.core.index,int64index
    # type of colname is dict


def mapsignal(data):
    totalfig = len(data)
    f, axarr = plt.subplots(totalfig, sharex=True, sharey=False)

    for i in range(0, totalfig):
        print(i)
        data[i] = data[i].astype(np.float128)  # !!! here only float128 !!! not float, not float64 ...
        axarr[i].plot(range(0, len(data[i])), data[i], color='r')
    plt.show()


Signal = readcsv()  # select file and read csv
mapsignal(Signal)
